There are dozens of ways to do push-ups. I do at least three different types on a regular basis, but the type of push-up you need to do for karate is sometimes referred to as the "military push-up."
In this style of push-up your hands should be directly beneath your shoulders. Having your hands too high or low will not only make the push-ups far more difficult, it will also put unhealthy pressure on your shoulders. When you bend your arms, your elbows should rub up against the sides of your body. As with many other styles of push-ups, your feet should be together.
Some karate-ka (myself included) do push-ups on their first two knuckles rather than on open palms. For your health and safety, this is not allowed unless you are 13 years old or older. In addition to potential injuries on still developing bodies, knuckle push-ups can also build excessive callouses on your knuckles if they are not properly taken care of.
How many push-ups should I do? Well, the more the better. But try to do at least 5 push-ups for each karate belt you've earned. (white belts = 5, yellow belts = 10) Do this practice at least four times per week including karate class.
What should I do if I struggle with push-ups? There are various techniques to help build your strength. One is doing push-ups from your knees rather than from your feet. This makes the push-ups easier. For this strategy, do as many regular push-ups as you can and then when you can't do any more switch to the knee push-ups. Another strategy is doing your push-ups on an incline. This also decreases the weight you are lifting, thus making the push-ups easier. A third strategy is exercising the different muscles involved separately. I often find this with adult students. They notice that they have very strong arms but still struggle with push-ups. This is because push-ups also involve the ab muscles.